package com.freewater.javabase.demo.designpattern.command2.simple.client;

import com.freewater.javabase.demo.designpattern.command2.simple.command.GarageDoorOpenCommand;
import com.freewater.javabase.demo.designpattern.command2.simple.command.LightOnCommand;
import com.freewater.javabase.demo.designpattern.command2.simple.invoker.SimpleRemoteController;
import com.freewater.javabase.demo.designpattern.command2.simple.receiver.Garage;
import com.freewater.javabase.demo.designpattern.command2.simple.receiver.Light;

/**
* 客户端
* Created by FreeWater on 2017/4/4.
*/
public class SimpleRemoteControllerTest {
	public static void main(String[] args) {
		Light light = new Light();
		LightOnCommand lightOnCommand = new LightOnCommand(light);

		Garage garage = new Garage();
		GarageDoorOpenCommand garageDoorOpenCommand = new GarageDoorOpenCommand(garage);

		SimpleRemoteController controller = new SimpleRemoteController();
		controller.setSlot(lightOnCommand);
		controller.buttonWasPressed();

		controller.setSlot(garageDoorOpenCommand);
		controller.buttonWasPressed();
	}
}
